package com.xiguaapp.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xiguaapp.vo.StudentVo;

@Controller
public class FontController {
//			1、用表单实现对象、集合(List<String>|Map)、数组类型的参数注入
	@RequestMapping("/login")
	public String foObj(StudentVo studentVo) {
			System.out.println(studentVo);
		return "Succsessful";
	}
	
	@RequestMapping(value = "/foList")
	public String fooList(@RequestParam List<String> name) {
		name.forEach(System.out::println);
		return "Succsessful";
	}
	@RequestMapping(value = "/forArgs")
	public String foArgs(String [] name) {
		for (String string : name) {
			System.out.println(string);
		}
		return "Succsessful";
	}
	@RequestMapping("/forVo")
	public String forVo(@RequestParam List<String> name) {
		System.out.println(name);
		return "Succsessful";
	}
	@RequestMapping("/getList")
	@ResponseBody
	public List<StudentVo> getList(){
		List<StudentVo> list=new ArrayList<StudentVo>();
		StudentVo sVo=new StudentVo();
		sVo.setName("haha");
		sVo.setPwd("12134");
		list.add(sVo);
		return list;
	}
	@RequestMapping(value="/update",method = RequestMethod.PUT)
	@ResponseBody
	public String update(@RequestBody StudentVo studentVo) {
		System.out.println(studentVo);
		return "abc";
	}
}
